//
//  BFGridItem.h
//  13KModel
//
//  Created by jack on 1/09/12.
//  Copyright (c) 2012 butterfly. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef enum{
    BFGridItemNormalState = 0,
    BFGridItemEditState = 1
} BFGridItemState;

@protocol BFGridItemDelegate;

@interface BFGridItem : UIView
{
@protected
    UIButton *entry;
    
@private
    UILabel *labelText;
    
@private
    UIButton *deleteBtn;
}

@property(nonatomic) BOOL isEditing;
@property(nonatomic) BOOL isRemovable;
@property(nonatomic) NSInteger index;
@property(nonatomic) NSInteger section;
@property(weak,nonatomic)id<BFGridItemDelegate> delegate;

-(id)initWithTitle:(NSString*)title imageName:(NSString*)name
           section:(NSInteger)aSection atIndex:(NSInteger)aIndex editable:(BOOL)removable;
- (void) enableEditing;
- (void) disableEditing;;

@end

@protocol BFGridItemDelegate <NSObject>

- (void) gridItemDidClicked:(BFGridItem *) gridItem;
- (void) gridItemDidEnterEditingMode:(BFGridItem *) gridItem;
- (void) gridItemDidDeleted:(BFGridItem *) gridItem
                   aSection:(NSInteger)section atIndex:(NSInteger)index;
- (void) gridItemDidMoved:(BFGridItem *) gridItem withLocation:(CGPoint)point moveGestureRecognizer:(UILongPressGestureRecognizer*)recognizer;
- (void) gridItemDidEndMoved:(BFGridItem *) gridItem withLocation:(CGPoint)point moveGestureRecognizer:(UILongPressGestureRecognizer*) recognizer;
@end